//引入封装的reuest请求
const { request } = require('./request.js')
//基于业务封装的接口
module.exports={
	/* 首页 */
	indexFresh:()=>{
    return request('project/fresh','GET',{})
	},
	/* 首页详情 */
	indexDetail:(projectId)=>{
		return request(`project/${projectId}/details`,'GET',{});
	},
	/* 首页详情收藏 */
	indexCollect: (userId,projectId)=>{
		return request(`user/${userId}/collect`, 'POST', {projectId});
	},
	/* 首页用户点赞 */
	indexLike:(userId,projectId)=>{
		return request(`user/${userId}/like`, 'POST', {projectId});
	},
	indexFollow:(userId,projectId,followUserId)=>{
		return request(`user/${userId}/follow`, 'POST', {projectId,followUserId});
	},
	// 根据id获取团队信息
	indexTeamDetail:(projectId)=>{
		return request(`team/${projectId}/detail`, 'GET', {});
	},
	// 申请加入团队
	indexTeamJoin:(teamId,userId)=>{
		return request(`team/join`, 'POST', {teamId,userId});
	},
	// 首页查询
	indexSearch:(key)=>{
		return request(`project/search`,'GET',{key})
	},
	//获取简历
	getResume: (userId)=>{
		return request(`resume/${userId}/`,'GET')
	},
	//获取用户标签
	getTag:(userId)=>{
		return request(`tag/${userId}/user`,'GET')
	},
	getCollect:(userId)=>{
		return request(`user/${userId}/collect`,'GET')
	},
	getFollow:(userId)=>{
		return request(`user/${userId}/follow`,'GET')
	},
	//用户发布的项目
	publishPro:(userId)=>{
		return request(`user/${userId}/projects`,'GET')
	},
	feedback:(userId,opinion)=>{
		return request(`opinoin/${userId}/`,'POST',opinion)
	},
	findFeedback:(userId)=>{
		return request(`opinoin/${userId}/`,'GET',{userId})
	},
	//查看所有标签
	allTag:()=>{
		return request(`tag/`,'GET')
	},
	//为用户添加标签
	addTag:(userId,tags)=>{
		return request(`tag/${userId}/user?tags=`+tags,'POST')
	},
	//获取用户标签
	getTag:(userId)=>{
		return request(`tag/${userId}/user`,'GET')
	},
	//获取用户基本信息
	getUserProfile:(userId)=>{
		return request(`user/${userId}/baseInfo`,'GET')
	},
	//修改用户信息
	changeInfo:(userId,userProfile )=>{
		return request(`user/${userId}/info`,'PUT',userProfile )
	},
	//用户发布项目
	// release:(file,projectDto)=>{
	// 	return request(`project/release`,'POST',{file,projectDto})
	// }
	// 为项目添加标签
	project:(projectId,tags)=>{	
		return request(`/tag/${projectId}/project?tags=`+tags,'POST')
	},
	//创建团队
	makeTeam:(teamDto)=>{
		return request(`team/create`,'POST',teamDto)
	},
	//团队队员推荐
	recommendMember:(projectId)=>{
		return request(`recommend/${projectId}/member`,'GET')
	},
	//项目推荐
	recommendItem:(userId)=>{
		return request(`recommend/${userId}/project`,'GET')
	}
}

